package com.music.biz.imp;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.music.biz.OrderBiz;
import com.music.dao.OrderDao;
import com.music.entity.Order;

@Service("orderBiz")
public class OrderBizImpl implements OrderBiz {

	@Autowired
	private OrderDao orderDao;

	public void setOrderDao(OrderDao orderDao) {
		this.orderDao = orderDao;
	}

	@Transactional(propagation = Propagation.REQUIRED)
	public void addOrder(Order order) {
		orderDao.addOrder(order);
	}

	@Transactional(propagation = Propagation.REQUIRED)
	public void updateState(int id) {
		orderDao.updateState(id);
	}

	@Transactional(propagation = Propagation.REQUIRED)
	public void updateRecipients(Order order) {
		orderDao.updateRecipients(order);
	}

	public Order getOrderById(int oid) {
		return orderDao.getOrderById(oid);
	}

	@Override
	public List<Order> getAll() {
		// TODO Auto-generated method stub
		return orderDao.getAll();
	}

	@Override
	public List<Order> getOrders(int state, int id, String max, String min) {
		// TODO Auto-generated method stub
		return orderDao.getOrders(state, id, max, min);
	}

	
	
}
